package com.xuexie.mr;

import org.apache.hadoop.io.WritableComparable;
import org.apache.hadoop.io.WritableComparator;

public class MyGroup extends WritableComparator{

	public MyGroup(){
		super(MyBean.class,true);
	}
	
	public int compare(WritableComparable a, WritableComparable b) {
		MyBean o1 =(MyBean) a;
		MyBean o2 =(MyBean) b;
		int result =Integer.compare(o1.getYear(), o2.getYear());
		if(result==0){
			result =Integer.compare(o1.getMounth(), o2.getMounth());
		}
		return result;
	}
	
}
